home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Telephone Manager / Stiletto Sources / ModuleSources / TeleGestalt.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-07-06  |  3.2 KB  |  108 lines  |  [TEXT/MPS ]

  1. /************************************************************************************************/
  2. /*                                                                                                */
  3. /*    Module Name:    TeleGestalt                                                                    */
  4. /*                                                                                                */
  5. /*    File Name:        TeleGestalt.c                                                                */
  6. /*                                                                                                */
  7. /*    © Apple Computer, Inc. 1994-1995                                                            */
  8. /*    All Rights Reserved                                                                            */
  9. /*                                                                                                */
  10. /*    Revision History:                                                                            */
  11. /*                                                                                                */
  12. /*        Date        Who                    Modification                                            */
  13. /*                                                                                                */
  14. /*        1994-10-26    Jaakko Railo        Original version                                        */
  15. /*                                                                                                */
  16. /************************************************************************************************/
  17.  
  18. /****************************************** DESCRIPTION ******************************************
  19.  
  20. *************************************************************************************************/
  21.  
  22. /******************************************** HEADERS *******************************************/
  23.  
  24. #ifndef __GESTALT__
  25. #include "Gestalt.h"
  26. #endif
  27.  
  28. #ifndef __TOOLUTILS__
  29. #include "ToolUtils.h"
  30. #endif
  31.  
  32. #ifndef __TELEPHONES__
  33. #include "Telephones.h"
  34. #endif
  35.  
  36. #include "TestModule.h"
  37.  
  38. /****************************************** DEFINITIONS *****************************************/
  39.  
  40. #if defined(powerc) || defined (__powerc)
  41. #pragma options align=mac68k
  42. #endif
  43. struct FeatureStructure {
  44.     char    *name;
  45.     short    feature;
  46. };
  47. #if defined(powerc) || defined(__powerc)
  48. #pragma options align=reset
  49. #endif
  50.  
  51. typedef struct FeatureStructure FeatureStructure;
  52.  
  53. /****************************************** PROTOTYPES ******************************************/
  54.  
  55. void         DoTest (CHRSPtr paramPtr);
  56.  
  57. /************************************************************************************************/
  58. /************************************************************************************************/
  59.  
  60.  
  61. pascal short TestModule (CHRSPtr paramPtr)
  62. {
  63.     short    returnValue = noErr;
  64.     
  65.     if (paramPtr->version <= kTestModuleVersion) {
  66.         
  67.         DoTest (paramPtr);
  68.         
  69.     }
  70.     else
  71.         returnValue = kWrongVersion;
  72.         
  73.     return (returnValue);
  74. }
  75.  
  76.  
  77. void DoTest (CHRSPtr paramPtr)
  78. {
  79.     OSErr                errCode;
  80.     long                response;
  81.     Boolean                supportsIt;
  82.     short                index;
  83.     FeatureStructure     array[] = {
  84.         { "gestaltTeleMgrPresent",            gestaltTeleMgrPresent },        
  85.         { "gestaltTeleMgrPowerPCSupport",    gestaltTeleMgrPowerPCSupport },        
  86.         { "gestaltTeleMgrSoundStreams",        gestaltTeleMgrSoundStreams },        
  87.         { "gestaltTeleMgrAutoAnswer",        gestaltTeleMgrAutoAnswer },        
  88.         { "gestaltTeleMgrIndHandset",        gestaltTeleMgrIndHandset },        
  89.         { "gestaltTeleMgrSilenceDetect",    gestaltTeleMgrSilenceDetect },
  90.         { "gestaltTeleMgrNewTELNewSupport",    gestaltTeleMgrNewTELNewSupport }
  91.     };
  92.     
  93.     
  94.     if ((errCode = Gestalt (gestaltConnMgrAttr, &response)) == noErr) {
  95.         supportsIt = BitTst (&response, 31 - gestaltConnMgrPresent);
  96.         Print (paramPtr, "%s %s", (supportsIt?"√":" "), "gestaltConnMgrPresent");
  97.     }
  98.  
  99.     for (index = 0; index < (sizeof(array) / sizeof(FeatureStructure)); ++index) {
  100.         if ((errCode = Gestalt (gestaltTeleMgrAttr, &response)) == noErr) {
  101.             supportsIt = BitTst (&response, 31 - array[index].feature);
  102.             Print (paramPtr, "%s %s", (supportsIt?"√":" "), array[index].name);
  103.         }
  104.         else
  105.             Print (paramPtr, "### Gestalt failed : %d", errCode);
  106.     }
  107. }
  108.